$(document).ready(function(){
	$("#btn_login").click(function(){
		var userid = $("#user_id").val();
		var password = $("#password").val();
		var pattern = /[a-zA-Z0-9]{4,20}/;
		
		if (userid == "" || !pattern.test(userid)) {
			$("#error_message").html("用户名错误<br/>");
			$("#user_id").css("background", "#fbe2e2");
			return;
		} else {
			$("#error_message").html("");
			$("#user_id").css("background", "#ffffff");
		}
		
		if (password == "" || !pattern.test(password)) {
			$("#error_message").html("密码错误<br/>");
			$("#password").css("background", "#fbe2e2");
			return;
		} else {
			$("#error_message").html("");
			$("#password").css("background", "#ffffff");
		}
		
		$("#frm_login").submit();
	});
});